<?php
     //引入配置文件
	require '../public/config.php';
	require '../public/mysql.php';
	//开启session
	session_start();
	//获取session中购物车的数据
	$user= $_SESSION['admin']['user'] ;
	@$carts = $_SESSION['cart'];
	//链接数据库
	$link = connect();
	$sql = "select a.*,a.id aid,w.id wid from address a ,vip w where a.pid =w.id and w.username = '{$user}';";
//	var_dump($sql);
	if ($link['error']) {
		//执行查询的操作
		$address = query($link['mess'], $sql);
	}
//	var_dump($address);
?>

<html>
    <head>
	    <title>个人中心</title>
		<meta charset="utf-8">
		<link type="text/css" rel="stylesheet" href="style/reset.css">
		<link type="text/css" rel="stylesheet" href="style/address.css">
	</head>

    <body>
	    <div class="headerBar">
		
		<div class="topBar">
		        <div class="comWidth">
				 <?php if (empty($_SESSION['admin']['user']) ) :?>
					<a href="./web/login.php">登录</a>
					<a href="./web/adduser.php">注册</a>
					<?php else :?>
					<p>欢迎回来，<?php echo $_SESSION['admin']['user'];?>
					<a href="./web/dologin.php?a=logout">退出</a></p>
					<?php endif;?>
				</div>
		</div>

         <div class="logoBar">
		      <div class="comWidth">
			      <div class="logo fl">
				    <a href="#"><img src="./images/logo.jpg" alt="汤浅蓄电池"></a>
				  </div>
				  <div class="search_box fl">
				      <input type="text" class="search_text fl">
					  <input type="button" value="搜 索" class="search_btn fr">
				  </div>
				  <div class="shopCar fr">
				      <span class="shopText fl">购物车</span>
					  <span class="shopNum fl">0</span>
				  </div>
			  </div>
		 </div>
<!--  导航-->
        <div class="nav">
		
		   <div class="nav_left">
		     <h3>全部商品分类</h3>  
		   </div>
		    <ul class="nav_right">
			   <li class="nav_active1">电瓶上门</li>
			   <li class="nav_active">轮胎</li>
			   <li class="nav_active">保养</li>
			   <li class="nav_active">车品</li>
			   <li class="nav_active">轮毂</li>
			   <li class="nav_active">服务门店</li>
		    </ul>
		
		
		
		</div>  

<!-- 内容 -->       
<div class="main w1210 bc mt10">
		<div class="crumb w1210">
			<h2><strong>个人中心 </strong><span>> 我的收货地址</span></h2>
		</div>
		
		<!-- 左侧导航菜单 start -->
		<div class="menu fl">
			<h3>功能表</h3>
			<div class="menu_wrap">
				<dl>
					<dt>订单中心 <b></b></dt>
					<dd><b>.</b><a href="">我的订单</a></dd>
					<dd><b>.</b><a href="">我的关注</a></dd>
					<dd><b>.</b><a href="">浏览历史</a></dd>
					<dd><b>.</b><a href="">我的团购</a></dd>
				</dl>

				<dl>
				<?php foreach($address as $val):?>
					<dt>账户中心 <b></b></dt>
					<dd class="cur"><b>.</b><a href="">账户信息</a></dd>
					<dd><b>.</b><a href="./password.php?id=<?php echo $val['id']?>">修改密码</a></dd>
					<dd><b>.</b><a href="">修改个人信息</a></dd>
					<dd><b>.</b><a href="">我的积分</a></dd>
					<dd><b>.</b><a href="">收货地址</a></dd>
						<?php endforeach;?>
				</dl>

				
			</div>
		</div>
		<!-- 左侧导航菜单 end -->

		<!-- 右侧内容区域 start -->
		<div class="content fl ml10">
			<div class="address_hd">
			
			</div>

			<div class="address_bd mt10">
				<h4>修改收货地址</h4>
				<form action="./action.php?a=address_edit" name="address_form" method="POST">
						<ul>
						<?php if(!empty($address)):?>
						<?php foreach($address as $val):?>
						  <input type="hidden" name="id" value="<?php echo $val['id']?>" />
							<li>
								<label for=""><span>*</span>收 货 人：</label>
								<input type="text" name="cons" class="txt" value="<?php echo $val['consignee']?>" />
							</li>
							<li>
								<label for=""><span>*</span>所在地区：</label>
								<select name="" id="">
									<option value="">请选择</option>
									<option value="">北京</option>
									<option value="">上海</option>
									<option value="">天津</option>
									<option value="">重庆</option>
									<option value="">武汉</option>
								</select>

								<select name="" id="">
									<option value="">请选择</option>
									<option value="">朝阳区</option>
									<option value="">东城区</option>
									<option value="">西城区</option>
									<option value="">海淀区</option>
									<option value="">昌平区</option>
								</select>

								<select name="" id="">
									<option value="">请选择</option>
									<option value="">西二旗</option>
									<option value="">西三旗</option>
									<option value="">三环以内</option>
								</select>
							</li>
							<li>
							
								<label for=""><span>*</span>详细地址：</label>
								<input type="text" name="addr" class="txt address" value="<?php echo $val['addr']?>" />
							</li>
							<li>
								<label for=""><span>*</span>手机号码：</label>
								<input type="text" name="phone" class="txt" value="<?php echo $val['phone']?>" />
							</li>
							<li>
								<label for="">&nbsp;</label>
								<input type="checkbox" name="" class="check" />设为默认地址
							</li>
							<li>
								<label for="">&nbsp;</label>
								<input type="submit" name="" class="btn" value="修改" />
							</li>
						</ul>
						<?php endforeach;?>
						<?php else:?>
							暂无信息
						<?php endif?>
					</form>
			</div>	

		</div>
			
		
		<!-- 右侧内容区域 end -->
	</div>
	<!-- 页面主体 end-->

	
<!-- 商品详情结束 -->


<a style="margin-left:180px;"><img src="./images/weibu.jpg"></a>
    
























	</body>
</html>